<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="/style/cssMain.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/style/jQuery.js"></script>
    <script type="text/javascript" src="/style/jsMain.js"></script>
    <script type="text/javascript" src="/style/jsManage.js"></script>
  </head>
  
  <body>
   <div id="eBody">
      <div class="eTag">
        <ul>
          <li class="eSelected">
		  	<?php if(isset($eCID) && $eCID == 1):?>
		  		首页广告
		  	<?php endif;?>
		  	<?php if(isset($eCID) && $eCID == 2):?>
		  		街道轮播
		  	<?php endif;?>
		  	<?php if(isset($eCID) && $eCID == 3):?>
		  		小店轮播
		  	<?php endif;?>
		  	<?php if(isset($eCID) && $eCID == 4):?>
		  		小店友情链接
		  	<?php endif;?>
		  </li>
        </ul>
      </div>
      <form id="eForm" action="<?php echo site_url('mang/adv/action?cid='.$eCID); ?>" method="post">
        <div class="eSheet eBorder">

          <div id="PicList">
          	<?php foreach ($advList as $key=>$adv):?>
		  	<div style="margin: 10px 0; border-bottom: 1px solid #CCC;" id="piclist_<?php echo $key?>">
				<div style="margin: 10px 0;"><img id="picSrc<?php echo $key?>" src="<?php echo $adv['image']?>" height="60"></div> 
				<iframe style="margin-top: 5px;" src="<?php echo site_url('mang/upload')?>?id=<?php echo $key?>&amp;type=list" width="100%" height="45" scrolling="no" frameborder="0"></iframe> 
				<div style="margin: 10px 0;">
				  <input id="picUrl<?php echo $key?>" type="hidden" name="url[]" value="<?php echo $adv['image']?>">
				  标题：<input type="text" name="title[]" value="<?php echo $adv['title']?>" style="width: 450px;"><br />
				 链接：<input type="text" name="link[]" value="<?php echo $adv['link']?>" style="width: 450px;"><br />
				  排序：<input type="text" name="sort[]" value="<?php echo $adv['sort']?>" style="width: 45px;">
				</div>
				<div style="margin: 10px 0;"><a href="javascript:" onclick="delPic(<?php echo $key?>)">删除</a></div>
			  </div>
			  <?php endforeach;?>
          </div>
          <input class="button" name="submit" type="submit" value="保存">
          <input class="button" type="button" value="新增" onClick="addPic()">
        </div>
      </form>
    </div>
  </body>
  <script>
  function delPic(id) {

	  $("#piclist_" + id).remove();

	}

	

	function addPic() {

	  var myDate = new Date();

	  var myTime = Math.round(myDate.getTime() / 1000);

      $("#PicList").append("<div style=\"margin: 10px 0;\" id=\"piclist_"+myTime+"\">"+
		"<div style=\"margin: 10px 0;\"><img id=\"picSrc"+myTime+"\" src=\"/style/images/pictures.png\" height=\"60\"></div>"+
		"<iframe style=\"margin-top: 5px;\" src=\"<?php echo site_url('mang/upload'); ?>?id="+myTime+"&type=list\" width=\"100%\" "+
		"height=\"45\" scrolling=\"no\" frameborder=\"0\"></iframe><div style=\"margin: 10px 0;\">"+
		"<input id=\"picUrl"+myTime+"\" type=\"hidden\" name=\"url[]\" value=\"\">"+
		"标题：<input type=\"text\" name=\"title[]\" value=\"\" style=\"width: 450px;\"><br />"+
		"链接：<input type=\"text\" name=\"link[]\" value=\"http://\" style=\"width: 450px;\"><br />"+
		"排序：<input type=\"text\" name=\"sort[]\" value=\"0\" style=\"width: 45px;\">"+
		"</div><div style=\"margin: 10px 0;\">"+
		"<a href=\"javascript:\" onClick=\"delPic("+myTime+")\">删除</a></div></div>");

	}

  </script>
</html>
